<script>
function JSCstartdrag(t, e) { //mouse down on dragged DIV element
if (e.preventDefault) e.preventDefault(); // IE compatibility
e.cancelBubble = true;
window.document.onmousemoveOld = window.document.onmousemove;
window.document.onmouseupOld = window.document.onmouseup;
window.document.onmousemove=JSCdodrag;
window.document.onmouseup=JSCstopdrag;
window.document.draged = t;
t.dragX = e.clientX;
t.dragY = e.clientY;
return false;
}
function JSCdodrag(e) { //move the DIV
if (!e) e = event; // IE compatibility
var t = window.document.draged;
t.style.left = (t.offsetLeft + e.clientX - t.dragX)+"px";
t.style.top = (t.offsetTop + e.clientY - t.dragY)+"px";
t.dragX = e.clientX;
t.dragY = e.clientY;
return false;
}
function JSCstopdrag() {
window.document.onmousemove=window.document.onmousemoveOld;
window.document.onmouseup=window.document.onmouseupOld;
}
function WRITE(s) {
document.getElementById('JSCOutArea').innerHTML+= ' '+s.toString().replace(/n/g, " ");
}
function JSCrun() {
new Function("{n"+document.getElementById('JSCcode').value+"n}")();
document.getElementById('JSCOutArea').scrollTop = document.getElementById('JSCOutArea').scrollHeight;
}
function JSCclear() {
document.getElementById('JSCOutArea').innerHTML = "";
}
function JSCerror(err) {
document.getElementById('JSCOutArea').innerHTML += " "+err.replace("n", " ")+" ";
document.getElementById('JSCOutArea').scrollTop = document.getElementById('JSCOutArea').scrollHeight;
}
function JSCinit() {
if (document.getElementById('JSConsole') != null) {
document.body.removeChild(document.getElementById('JSConsole'));
window.onscroll = null;
window.onerror = null;
return;
}
var s="";
var sd = document.createElement("DIV");
sd.style.position="absolute";
sd.style.background="white";
sd.style.border="1px solid black";
sd.style.fontSize="11px";
sd.style.lineHeight='15px';
sd.style.top = (document.documentElement.scrollTop+document.documentElement.clientHeight/2-180)+"px";
sd.style.left = (document.documentElement.scrollLeft+document.documentElement.clientWidth/2-200)+"px";
sd.id = "JSConsole";
sd.innerHTML=s;
document.body.appendChild(sd);
window.onscroll = JSCscroll;
window.onerror = JSCerror;
}
function JSCscroll() {
var md = document.getElementById('JSConsole');
if (md.offsetTop > document.documentElement.scrollTop+document.documentElement.clientHeight-350) md.style.top = (document.documentElement.scrollTop+document.documentElement.clientHeight-350) + "px";
if (md.offsetTop < document.documentElement.scrollTop) md.style.top = document.documentElement.scrollTop + "px";
if (md.offsetLeft < document.documentElement.scrollLeft) md.style.left = document.documentElement.scrollLeft + "px";
}
function JSChelp(){
var jtop=window.open('http://htmlweb.ru/java/example/javascript_console.php','', 'height=768,width=1024,location=no,toolbar=no,directories=no,menubar=no,status=yes,scrollbars=1,resizable=yes');
jtop.focus();
jtop.name='example';
return false;
}
function DOM(s) {
if (typeof(s)=="object") ;
else if ((typeof(document.getElementsByTagName(s))=="object")&&(document.getElementsByTagName(s).length>0)) s=document.getElementsByTagName(s);
else if (typeof(document.getElementById(s))=="object") s=document.getElementById(s);
if (typeof(s)=="object") {
var o = s;
s = "";
for (var i in o){
/*@cc_on @*/
/*@if (@_jscript_version>4)
try
{@end @*/
JSCoi=o[i];
if(JSCoi)JSCoi=JSCoi.toString().replace(//g, ">");
s += ""+i+"="+JSCoi+" n";
/*@if (@_jscript_version>4)
}catch (err) {
s += i+"="+err.description+"n";
}
@end @*/
/*@cc_off @*/
}
}
WRITE(s);
}JSCinit();
</script>
| |